﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false" CodeFile="Lookup.aspx.vb" Inherits="Lookup" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register src="~/UserControls/OneFilteredDropDownList.ascx" tagname="OneFilteredDropDownList" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

       <br /><br />

    <table style="width:100%" >
        <tr>
            <td style="width:200px;">
                 &nbsp;&nbsp;  &nbsp;&nbsp;
                 
                 <asp:Label ID="lblCategory" runat="server" meta:resourcekey="lblCategory"></asp:Label>

                </td>
            <td style="width:200px;">
                <uc1:OneFilteredDropDownList ID="ddlMajorId" runat="server" AutoPostBack="True" 
                    DataSourceId="odsMajor" DataTextField="DescriptionEn" DataValueField="MAJOR" ValidationGroup="lookup" 
                    DefaultChoosedItem="ChooseOne" IsRequired="False" />
       
                </td>
                <td style="width:200px;">
                </td>
                <td style="width:200px;"></td>
        </tr>
        <tr>
            <td colspan="4">
                <br />
                <br />
                <telerik:RadGrid ID="rgLookup" runat="server" GridLines="None" DataSourceID="odsMainGrid"
                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="100%" AllowAutomaticUpdates="True"
                    AutoGenerateColumns="False" MasterTableView-Dir="<%$ Resources:SystemResource, HTMLDirectionality %>"
                    GroupPanel-Text="<%$ Resources:MainGrid ,GroupPanelText %>" CellSpacing="0" AllowPaging="true" PageSize="10">
                    <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="MAJOR,MINOR"
                        TableLayout="Fixed" DataSourceID="odsMainGrid" HorizontalAlign="NotSet"
                        NoMasterRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>">
                        <CommandItemTemplate>
                         <asp:ImageButton ID="ibtnInitInsert" CausesValidation="false" CommandName="InitInsert" runat="server"
                            ImageUrl="~/Design/images/Grid/AddRecord.gif" />
                            <asp:LinkButton ID="lbtnInitInsert" CausesValidation="false" runat="server" Font-Size="14px"
                                Text="<%$ Resources:MainGrid , AddNew %>" Visible="true" CommandName="InitInsert" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnEditSelected" CausesValidation="false" CommandName="EditSelected"
                                runat="server" ImageUrl="~/Design/images/Grid/Edit.gif" />
                            <asp:LinkButton ID="lbtnEditSelected" CausesValidation="false" runat="server" Font-Size="Medium"
                                Text="<%$ Resources:MainGrid , EditSelected %>" Visible="true" CommandName="EditSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnDeleteSelected" CausesValidation="false" CommandName="DeleteSelected"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                ImageUrl="~/Design/images/Grid/Delete.gif" />
                            <asp:LinkButton ID="lbtnDeleteSelected" Font-Size="Medium" CausesValidation="false"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                Text="<%$ Resources:MainGrid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnRebindGrid" CausesValidation="false" CommandName="RebindGrid"
                                runat="server" ImageUrl="~/Design/images/Grid/Refresh.gif" />
                            <asp:LinkButton ID="lbtnRebindGrid" Font-Size="Medium" CausesValidation="false" runat="server"
                                Text="<%$ Resources:MainGrid , Refresh %>" CommandName="RebindGrid" />
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton">
                                <ItemStyle CssClass="MyImageButton" Width="30px" />
                                <HeaderStyle Width="30px" />
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="MAJOR" meta:resourcekey="MAJOR" ReadOnly="True" SortExpression="MAJOR" UniqueName="MAJOR" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Minor" meta:resourcekey="Minor" ReadOnly="True" SortExpression="Minor" UniqueName="Minor" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DescriptionAr" meta:resourcekey="DescriptionAr" ReadOnly="True" SortExpression="DescriptionAr" UniqueName="DescriptionAr">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DescriptionEn" meta:resourcekey="DescriptionEn" SortExpression="DescriptionEn" UniqueName="DescriptionEn">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OrderID" meta:resourcekey="OrderID" SortExpression="OrderID" UniqueName="OrderID">
                                <ItemStyle Width="30px" />
                                <HeaderStyle Width="30px" />
                            </telerik:GridBoundColumn>
                            
                            <telerik:GridButtonColumn ConfirmText="<%$ Resources:MainGrid , ConfirmDelete %>"
                                ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>

                        
                           
                        </Columns>
                        <EditFormSettings EditFormType="Template">


                            <FormTemplate>
                                <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
                                    style="border-collapse: collapse;">
                              
                                    <tr>
                                        <td colspan="1" style="width: 500px">
                                            <table id="Table3" cellspacing="1" cellpadding="1" width="500" border="0" class="module">

                                                          <tr>
                                                    <td>
                                                        <asp:Label ID="lblCategoryID" meta:resourcekey="lblCategoryID" runat="server" SkinID="KeyLabel"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'></asp:Label></td>
                                                    <td>
                                                        <telerik:RadTextBox ID="rtbMinor" runat="server" Text='<%# Bind( "Minor") %>' SkinID="rtbSkin"
                                                            TextMode="MultiLine" Width="300px" ReadOnly="true"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'>
                                                        </telerik:RadTextBox>
                                  
                                                    </td>
                                                </tr>


                                
                                                 <tr>
                                                    <td>
                                                        <asp:Label ID="lblManrtxtEdtDescriptionEn" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                                                        <asp:Label ID="lblDescription" meta:resourcekey="lblDescription" runat="server" SkinID="KeyLabel"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadTextBox ID="rtbDescriptionEn" runat="server" Text='<%# Bind( "DescriptionEn") %>'
                                                            TextMode="MultiLine" Width="300px" SkinID="rtbSkin">
                                                        </telerik:RadTextBox>
                                                             <asp:RequiredFieldValidator ID="rfvrtbDescriptionEn" runat="server" ControlToValidate="rtbDescriptionEn"
                                                            ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="AddRow"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblManrtxtEdtDescriptionAr" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                                                        <asp:Label ID="Label1" meta:resourcekey="lblDescriptionAr" runat="server" SkinID="KeyLabel"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadTextBox ID="rtbDescriptionAr" runat="server" Text='<%# Bind( "DescriptionAr") %>'
                                                            TextMode="MultiLine" Width="300px" SkinID="rtbSkin">
                                                        </telerik:RadTextBox>
                                                             <asp:RequiredFieldValidator ID="rfvrtbDescriptionAr" runat="server" ControlToValidate="rtbDescriptionAr"
                                                            ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="AddRow"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>
                                                        
                                                        <asp:Label ID="lblrtbOrderID" meta:resourcekey="lblrcbOrderID" runat="server" SkinID="KeyLabel" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>' ></asp:Label></td>
                                                    <td>
                                                        <telerik:RadComboBox ID="rcbOrderID" DataSourceID="odsOrderID" DataTextField="OrderID" DataValueField="OrderID" Width="130px" SkinID="rcbSkin"
                                                         runat="server" SelectedValue='<%#Bind("OrderID") %>' Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'>
                                                        </telerik:RadComboBox>
                           
                                                    </td>
                                                </tr>

                                            </table>
                                        </td>
                                        <td style="width: 350px">
                                      </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <%--<asp:ImageButton ID="ibtnbtnEdtInsert" ImageUrl="~/Design/images/Update.gif" runat="server" CommandName="PerformInsert" ValidationGroup="AddRow" Text="Add" ToolTip="AddRow"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "True", "False") %>'/>
                                            <asp:ImageButton ID="ibtnbtnEdtUpdate" ImageUrl="~/Design/images/Update.gif" runat="server" CommandName="Update" ValidationGroup="AddRow" Text="Update" ToolTip="Update"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>' />
                                            <asp:ImageButton ID="ibtnbtnEdtCancel" ImageUrl="~/Design/images/Cancel.gif" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="False" ToolTip="Cancel" />--%>
                                             
                                            <telerik:RadButton ID="btnInsert" meta:ResourceKey="btnInsert" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "True", "False") %>'
                                                runat="server" CommandName = "PerformInsert"
                                                Icon-PrimaryIconCssClass="rbOk" >
                                            </telerik:RadButton>
                                            <telerik:RadButton ID="btnUpdate" meta:ResourceKey="btnUpdate" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'
                                                runat="server" CommandName = "Update" CausesValidation="true" ValidationGroup="ValEditMode"
                                                Icon-PrimaryIconCssClass="rbOk" >
                                            </telerik:RadButton>
                                            &nbsp;
                                            <telerik:RadButton ID="btnCancel" meta:ResourceKey="btnCancel" runat="server" CausesValidation="False"
                                                CommandName="Cancel" Icon-PrimaryIconCssClass="rbCancel">
                                            </telerik:RadButton>                                                                                                                                     
                                                
                                        </td>
                                    </tr>
                                </table>
                            </FormTemplate>
                            

                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" HorizontalAlign="Center" Wrap="false"   />
                    </MasterTableView>
                    <ClientSettings AllowDragToGroup="False">
                        <Scrolling AllowScroll="false" ScrollHeight ="300px"   />
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <FilterMenu EnableTheming="True" Skin="Vista">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset"></HeaderContextMenu>
  <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                </telerik:RadGrid>
                
                
                </td>
        </tr>
        <tr>
            <td colspan="4">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="4">
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="ddlMajorId">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="rgLookup" LoadingPanelID="RadAjaxLoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="odsMainGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="rgLookup">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="rgLookup" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Telerik" Transparency="20">
                </telerik:RadAjaxLoadingPanel>
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:ObjectDataSource ID="odsMajor" runat="server" SelectMethod="QueryDatabase" 
                    TypeName="DBlookup_tableSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RtvMajor" Name="Operation" Type="String" />
                        <asp:Parameter Name="MAJOR" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>

                <asp:ObjectDataSource ID="odsOrderID" runat="server" SelectMethod="QueryDatabase" 
                    TypeName="DBlookup_tableSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RtvOrderID" Name="Operation" Type="String" />
                        <asp:ControlParameter ControlID="ddlMajorId" PropertyName="SelectedValue" Name="MAJOR" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>

                <asp:ObjectDataSource ID="odsMainGrid" runat="server" 
                    DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
                    SelectMethod="QueryDatabase" TypeName="DBlookup_tableSP" 
                    UpdateMethod="QueryDatabase">
                    <DeleteParameters>
                        <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="DeleteLookUp" Name="Operation" Type="String" />
                        <asp:Parameter Name="MAJOR" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="SaveLookUp" Name="Operation" Type="String" />
                        <asp:ControlParameter ControlID="ddlMajorId" Name="MAJOR" PropertyName="SelectedValue" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RtvMinor" Name="Operation" Type="String" />
                        <asp:ControlParameter ControlID="ddlMajorId" Name="MAJOR" PropertyName="SelectedValue" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="SaveLookUp" Name="Operation" Type="String" />
                        <asp:ControlParameter ControlID="ddlMajorId" Name="MAJOR" PropertyName="SelectedValue" Type="String" />
                        <asp:Parameter Name="MINOR" Type="String" />
                        <asp:Parameter Name="DescriptionAr" Type="String" />
                        <asp:Parameter Name="DescriptionEn" Type="String" />
                        <asp:Parameter Name="OrderID" Type="String" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
            </td>
        </tr>
    </table>
</asp:Content>

